package com.ideaaedi.log4j2.defender.conerter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 脱敏配置类
 *
 * @author JustryDeng
 * @since 2021/7/21 1:15:15
 */
@Configuration
public class ConverterConfiguration {
    
    @Bean
    @ConfigurationPropertiesBinding
    public DefenderConverter registerDesensitizationHandlerConverter(@Autowired ApplicationContext applicationContext) {
        return new DefenderConverter(applicationContext);
    }
    
    @Bean
    @ConfigurationPropertiesBinding
    public DefenderStrategyConverter registerDesensitizationStrategyConverter(@Autowired ApplicationContext applicationContext) {
        return new DefenderStrategyConverter(applicationContext);
    }
    
    @Bean
    @ConfigurationPropertiesBinding
    public RegexDefenderStrategyProviderConverter registerRegexDefenderStrategyProviderConverter(@Autowired ApplicationContext applicationContext) {
        return new RegexDefenderStrategyProviderConverter(applicationContext);
    }
    
}